extends Sprite2D

var angular_speed = PI
@export var speed = 200
 
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	rotation += angular_speed * delta
	var velocity = Vector2.UP.rotated(rotation) * speed
	position += velocity * delta

func get_save_data():
	var save_dict = {
		"node_type":"scene",
		"filename" : get_scene_file_path(),
		"parent" : get_parent().get_path(),
		"path":get_path(),
		
		"pos_x" : position.x, # Vector2 is not supported by JSON
		"pos_y" : position.y,
		"rotation" : rotation
	}
	return save_dict
	
func load_save_data(node_data):
	position = Vector2(node_data["pos_x"], node_data["pos_y"])
	rotation = node_data["rotation"]
	
	#for i in node_data:
		#if i == "filename" or i == "parent" or i == "pos_x" or i == "pos_y"  or i == "rotate":
			#continue
		#self.set(i, node_data[i])
